import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../widgets/main_layout.dart';
import '../../core/viewmodels/auth_viewmodel.dart';

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  void initState() {
    super.initState();
    // 页面初始化时，检查登录状态并恢复用户信息
    WidgetsBinding.instance.addPostFrameCallback((_) {
      context.read<AuthViewModel>().checkLoginStatus();
    });
  }

  @override
  Widget build(BuildContext context) {
    return const MainLayout();
  }
}

